import time

import requests
from lxml import etree, html

url = 'https://www.manhuabaiku.com/custom/hot'
datas = []
res = requests.get(url)
# print(res)
res = res.text
# print(res)
html_tree = etree.HTML(res)
books = html_tree.xpath('//div[@class="cy_ph_list_mh"]/ul')
print(books)
# i = 1
# for book in books:
#     time.sleep(3)
#     # title = book.xpath("./li[3]/a/text()")[0]
#     main_image = book.xpath('./li[2]/a/img/@src')[0]
#     img_res = requests.get(main_image)
#     # print(main_image)
#     with open(f"../datas/漫百库/{i}.jpg", "wb") as f:
#         f.write(img_res.content)
#     i += 1
#     break
